﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<brjostagjof.Models.New>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Fréttir bls. <%: ((ViewData["pageID"]) as int?).Value + 1%>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <a href="/Home/Frettir/" class="linksWhite">Til baka í fréttir</a>
    <h2>Fleiri fréttir</h2>

        <%foreach (var item in Model)
        { %>
        <div class="entry">
        <div class="entry-bgtop">
        <div class="entry-bgbtm">
            <h2 class="title"><a href="<%: item.ArticleBase.link %><%: item.articleBaseID %>"><%: item.ArticleBase.InformationBase.headline%></a></h2>
            <p class="meta">Höfundur: <a href="../../MySite/ViewUserByID/<%:item.ArticleBase.User.ID  %>"><%: item.ArticleBase.User.name%></a>,  <%: item.ArticleBase.InformationBase.date%> 
	            &nbsp;&bull;&nbsp;
                <%  int count = brjostagjof.Controllers.HomeController.GetCommentsCountByArticleBaseID(item.articleBaseID); %>
                Umsagnir  (<%: count %>) &nbsp;&bull;&nbsp;
                <a href="/Home/GetNewsByCategoryID/<%: item.ArticleBase.ArticleCategory.ID %>" class="permalink"> <%: item.ArticleBase.ArticleCategory.name %></a>  
                &nbsp;&bull;&nbsp;
                <a href="<%: item.ArticleBase.link %><%: item.articleBaseID %>" class="permalink">Öll frétt</a></p>
        </div>
        </div>
        </div>
      <%  } %>
            <% int page = (ViewData["pageID"] as int?).Value; %>

            <%if(page==1)
              { %>
                  <a href="/Home/Frettir/" class="linksWhite">Nýrri fréttir</a>
            <% } %>

            <% if (page != 1)
               { %>
                    <a href="/Home/Get10NewsByPageID/<%:page-1 %>" class="linksWhite">Nýrri fréttir</a>
            <% } %>

            <% for (int i = page-4; i < page+5; i++)
            {%>
                <% if(i == 0)
                   { %>
                   <a href="/Home/Frettir/">1</a>
                       
                   <% }%>
                 <% if ((i > 0) && (i <= ((brjostagjof.Controllers.HomeController.GetAllNewsCount())/10)))
                { %>
                    <a href="/Home/Get10NewsByPageID/<%: i %>"><%: i + 1 %></a>
               <% }%>
           <% } %>
           
           <%if ((page-1 > 0) && (page < ((brjostagjof.Controllers.HomeController.GetAllNewsCount())/10)))
              { %>
                    <a href="/Home/Get10NewsByPageID/<%:page+1 %>" class="linksWhite">Eldri fréttir</a>
            <% } %>

</asp:Content>
